package geometry;

import ru.ts.gisutils.geometry.IXY;

import java.util.ListIterator;

/**
 * Created by IntelliJ IDEA.
 * User: sigolaev_va
 * Date: 25.01.2013
 * Time: 17:02:35
 * To change this template use File | Settings | File Templates.
 */
public interface IXYPolyline
{
  /**
   * Number of separate lines in this object
   * @return int with number of lines in the object
   */
  int size();

  /**
   * Gets current line at designated index
   * @param index int index of line to get
   * @return {@link IXYLine} found at designated index
   */
  IXYLine line(int index) throws ArrayIndexOutOfBoundsException;

  /**
   * Returns iterator for all lines
   * @return {@link ListIterator<IXYLine>} for lines in the internal array
   */
  ListIterator<IXYLine> getIterator();


  /**
   * Splits designated line with a point
   * @param index int with an index of line to insert new point into it
   * @param pnt {@link IXY} to split line
   */
  void split( int index, IXY pnt);

  /**
   * Insert before line is synonym for split (index-1, pnt), but for 1st line in this polyline it allow to create
   * new line before start one
   * @param index index to insert point, if 0, point creates new line at first position
   * @param point {@link IXY} point
   */
  void insertBefore( int index, IXY point );

  /**
   * Appends point to the end of current polyline, creating new trailing line, analogous to split( index+1, pnt)
   * @param point {@link IXY} point to append to
   */
  void append( IXY point);
}
